<template>
  <el-row class="tab-pane" :gutter="10">
    <el-col class="content" :lg="24">
      <p class="where">更多资源>></p>
      <template>
        <el-tabs v-model="activeName">
          <el-tab-pane name="first">
            <span slot="label">
              全部历史
              <img :src="icon" alt />
            </span>
          </el-tab-pane>
        </el-tabs>
      </template>
      <el-row class="tab-pane">
        <template>
          <el-tabs v-model="name" type="card">
            <el-tab-pane label="电子图书馆" class="first" name="first">
              <el-row class="list">
                <el-col
                  :span="12"
                  class="list-li"
                  @click.native="link"
                  v-for="(v,index) in datas"
                  :key="index"
                >
                  <el-row>
                    <el-col :span="8">
                      <img v-if="v.cover==null" :src="fm1" alt />
                      <img v-else :src="v.cover" alt />
                    </el-col>
                    <el-col :span="16">
                      <p class="name">{{v.title}}</p>
                      <p class="point">
                        <span>评分：</span>
                        <el-rate
                          v-model="v.rates"
                          disabled
                          show-score
                          text-color="#ff9900"
                          score-template="{value}"
                        ></el-rate>
                      </p>
                      <p class="info">
                        <span>简介:</span><span>{{v.description}}</span>
                      </p>
                     <p class="icon">浏览时间：{{v.create_time}}</p>
                    </el-col>
                  </el-row>
                </el-col>
              </el-row>
              <el-row class="total">
                <el-pagination @current-change="handleCurrentChange1"  background layout="prev, pager, next" :page-size="24" :total="book_total"></el-pagination>
              </el-row>
            </el-tab-pane>
            <el-tab-pane label="电子音像馆" class="second" name="second">
              <el-row class="list">
                <el-col :span="12" class="list-li" v-for="(v,index) in datasVideo" :key="index">
                  <el-row>
                    <el-col :span="8">
                      <img v-if="v.cover==null" :src="fm2" alt />
                      <img v-else :src="v.cover" alt />
                    </el-col>
                    <el-col :span="16">
                      <p class="name">{{v.title}}</p>
                      <p class="point">
                        <span>格式：</span>
                        <span class="type">{{v.format}}</span>
                      </p>
                      <p class="info">
                        <span>简介:</span>
                        <span>{{v.description}}</span>
                      </p>
                      <p class="icon">浏览时间：{{v.create_time}}</p>
                    </el-col>
                  </el-row>
                </el-col>
              </el-row>
              <el-row class="total">
                <el-pagination @current-change="handleCurrentChange2"  background layout="prev, pager, next" :page-size="24" :total="video_total"></el-pagination>
              </el-row>
            </el-tab-pane>
          </el-tabs>
        </template>
      </el-row>
    </el-col>
  </el-row>
</template>
<script>
import store from "../../store";
import { myCenter } from "@/api/index";
export default {
  name: "history",
  data() {
    return {
      value: 5,
      fm1: require("@/assets/index/fm1.png"),
      fm2: require("@/assets/index/fm2.png"),
      collection: require("@/assets/index/collection.png"),
      liulan: require("@/assets/index/liulan.png"),
      pinglun: require("@/assets/index/pinglun.png"),
      bg1: require("@/assets/index/bg_ziyuantongji.png"),
      bg2: require("@/assets/index/bg_yinxiang.png"),
      dw: require("@/assets/index/download.png"),
      icon: require("@/assets/index/record.png"),
      activeName: "first",
      name: "first",
      type: "first",
      activeIndex: 0,
      datas: [],
      datasVideo: [],
      intnum: undefined,
      form: {
        page: 1,
        page_size: 24,
        type: null,
        classify: null,
      },
      video_total: null,
      book_total: null,
    };
  },
  created() {
    this.dataList(1, 3,1);
    this.dataList(2, 3,1);
  },
  methods: {
    dataList(num, fl,val) {
      this.listLoading = true;
      let params = {
        page: val,
        page_size: 24,
        type: num,
        classify: fl,
      };
      myCenter(params).then((response) => {
        if (num == 1) {
          this.datas = response.data.data;
          this.book_total = response.total;
        } else {
          this.datasVideo = response.data.data;
          this.video_total = response.total;
        }
        this.listLoading = false;
      });
    },
    select(index) {
      this.active = index;
    },
    link() {
      this.$parent.select(4);
    },
      handleCurrentChange1(val) {
       this.dataList(1,3,val)
      },
        handleCurrentChange2(val) {
       this.dataList(2,3,val)
      }
  },
};
</script>
<style lang="scss" scoped>
.right-main {
  position: relative;
}
.content {
  position: relative;
}
.where {
  position: absolute;
  right: 0;
  top: 0;
  font-size: 18px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: rgba(142, 142, 142, 1);
}
.first {
  .info {
    position: relative;
    > span {
      position: absolute;
      left: 0;
      top: 6px;
    }
  }
}
.type {
  color: #ff9600;
}
.name {
  font-size: 24px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: rgba(22, 22, 22, 1);
  margin-top: 0;
}
.icon {
  padding-top:20px;
}
.list {
  margin-top: 30px;

  .el-col {
    padding-top: 20px !important;
  }
  .el-col-4 {
    padding: 0 20px;
  }
  .el-col-8 {
    img {
      width: 90%;
      margin-left: 0;
    }
  }
  > .el-col-12 {
    width: 48%;
  }
  > .el-col-12:nth-child(odd) {
    margin-right: 4%;
  }
  .el-col-16 {
    padding-left: 20px;
  }
}
.list-li {
  padding-bottom: 30px;
  cursor: pointer;
  > .el-row {
    border: 1px solid #ddd;
    padding: 20px;
  }
}
.icon {
  font-size: 18px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: rgba(142, 142, 142, 1);
  img {
    margin-right: 10px;
  }
}
.el-carousel__container {
  background: rgba(255, 255, 255, 1);
  border: 1px solid rgba(220, 220, 220, 1);
  box-shadow: 1px 2px 10px 0px rgba(153, 153, 153, 0.23);
  border-radius: 10px;
  padding: 20px;
}

.the-name {
  font-size: 22px;
  font-family: Microsoft YaHei;
  font-weight: 300;
  color: rgba(19, 104, 107, 1);
  margin: 10px 0 0 0;
}
.author {
  font-size: 18px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: rgba(22, 22, 22, 1);
  margin: 10px 0 0 0;
}
.total {
  text-align: center;
  padding-top: 200px;
  padding-bottom: 80px;
}
</style>
<style lang="scss">
ul,
li {
  padding: 0;
  list-style: none;
}
.tab-pane .el-tabs__item {
  font-size: 20px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: rgba(80, 80, 80, 1);
  line-height: 50px !important;
}
.tab-pane .el-tabs__item.is-active {
  color: #1ca2a8;
  img {
    margin-left: 20px;
    margin-bottom: -2px;
  }
}
.tab-pane .el-tabs__active-bar {
  background-color: #1ca2a8;
  width: 80px !important;
}
.tab-pane .el-tabs__item {
  height: 50px;
  line-height: normal;
}
.tab-pane .el-tabs__header {
  margin: 0;
}
.info .el-button {
  border: none;
  padding: 0;
  width: 100%;
  line-height: 30px;
  white-space: normal;
  text-align: left;
  text-indent: 45px;
  span {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-size: 20px;
    color: #4f4f4f;
  }
}
.info {
  .el-button:hover {
    background: none;
  }
}
.tab-pane .el-tabs--card > .el-tabs__header .el-tabs__nav {
  float: right;
}
.el-carousel__container {
  margin-top: 30px;
  background: rgba(255, 255, 255, 1);
  border: 1px solid rgba(220, 220, 220, 1);
  box-shadow: 1px 2px 10px 0px rgba(153, 153, 153, 0.23);
  border-radius: 10px;
  overflow: hidden;
}
.zy1,
.zy2 {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 120px;
  text-align: center;
  margin-top: 20px;
  background-size: 100% !important;
  span {
    margin: 0 10px;
  }
  span:first-child {
    font-size: 21px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: rgba(255, 255, 255, 1);
  }
  span:last-child {
    font-size: 41px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    font-style: italic;
    color: rgba(255, 255, 255, 1);
  }
}
.tab-pane .el-tabs--card > .el-tabs__header {
  border-bottom: none;
}
.tab-pane .el-tabs--card > .el-tabs__header .el-tabs__item {
  border-color: #e4e7ed;
}
.tab-pane .el-tabs--card > .el-tabs__header .el-tabs__item.is-active {
  border-bottom: none;
}
</style>